package LinesCraft;

public class Inventory {

	static Items[] inventory = new Items[1700];	// 3*9*64=1728 slots
	// here you can stack anything limitless. It's not fair how 64 m^3 take the same size of room as one shovel.

	void add(Items item, int amo){
		int i=0;
		while(inventory[i]==item){
			inventory[i].amount=inventory[i].amount+amo;
		}
		while(inventory[i] != null){		// places the item to the first empty slot
			i++;
		}
		inventory[i]=item;
	}
	
	//dropping methods(both do the same quite much)
	static void drop(Items item){
		int i=0;
		while(inventory[i]!=item){
			i++;
		}
		inventory[i]=null;
	}
	
	static void drop(Items item, int amo){	//mostly for dropping blocks, or things like torches, but usable if you have 50 wooden shovels :D
		int i=0;
		while(inventory[i]!=item){
			i++;
		}
		inventory[i].amount=inventory[i].amount-amo;
	}
	
	
	static void list(){
		System.out.print("Your inventory: ");
		for(int i=0; i<inventory.length; i++){
			if(inventory[i] != null){
				System.out.println(inventory[i]);
			}
		}
	}
	
}
